//
//  Team9CommentInspirationTableViewCell.m
//  Team9Project
//
//  Created by dllo on 15/10/16.
//  Copyright © 2015年 apple. All rights reserved.
//

#import "Team9CommentInspirationTableViewCell.h"
#import <Masonry.h>

#define WID 375.0
//#define HEI 667.0

@implementation Team9CommentInspirationTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.author_faceImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.author_faceImageView];
    self.author_faceImageView.layer.cornerRadius = 20 / WID * WIDTH;
    self.author_faceImageView.layer.masksToBounds = YES;
    
    self.author_nickLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.author_nickLabel];
    self.author_nickLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
    self.author_nickLabel.textColor = [UIColor orangeColor];
    
    self.contentLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.contentLabel];
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
    
    self.create_timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.create_timeLabel];
    self.create_timeLabel.textAlignment = NSTextAlignmentRight;
    self.create_timeLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
    
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
//    self.author_faceImageView.frame = CGRectMake(10, 5, 40, 40);
    [self.author_faceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(10 / WID * WIDTH);
        make.top.equalTo(self.contentView.mas_top).offset(5 / WID * WIDTH);
        make.width.height.equalTo(@(40 / WID * WIDTH));
    }];
    
    [self.create_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView.mas_right).offset(-10 / WID * WIDTH);
        make.width.equalTo(@(70 / WID * WIDTH));
        make.height.equalTo(@(30 / WID * WIDTH));
    }];
    
    [self.author_nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.author_faceImageView.mas_right).offset(5 / WID * WIDTH);
        make.right.equalTo(self.create_timeLabel.mas_left).offset(-5 / WID * WIDTH);
        make.top.equalTo(self.author_faceImageView);
        make.height.equalTo(@(25 / WID * WIDTH));
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.author_nickLabel);
        make.top.equalTo(self.author_nickLabel.mas_bottom).offset(0);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-5 / WID * WIDTH);
    }];
    
}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
